using System;
using System.Activities;
using System.Activities.Statements;
using Headsight.BPMN2WF.Transformation;
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace Headsight.BPMN2WF.WF.Simplification
{
    [TestClass]
    public class WFSimplifier_FlowchartTest : WFSimplifier_TestFixture<WFSimplifierFlowchart>
    {
        private Flowchart _flowchart;
        private Object _flowIn;
        private Object _flowOut;

        protected override WFSimplifierFlowchart CreateSut()
        {
            _flowchart = new Flowchart();
            _flowIn = new Object();
            _flowOut = new Object();

            return new WFSimplifierFlowchart();
        }

        private void Verify_BPMNTransformationResult(Activity activity, BPMNTransformationResult actual)
        {
            // This kind of simplication shall not alter the overall / original's BPMNTransformation result;
            // the respective operation operates on 'lower' (non-block) level and therefore does not
            // change an block's overall result.
            Assert.AreSame(activity, actual.Result);
            Assert.AreSame(_flowIn, actual.FlowIn);
            Assert.AreSame(_flowOut, actual.FlowOut);
        }

        private BPMNTransformationResult CreateBPMNTransformationResult(Activity activity)
        {
            return new BPMNTransformationResult(activity, _flowIn, _flowOut);
        }

        [TestMethod]
        public void Probe_inco_Flowchart()
        {
            Assert.AreEqual(true, _sut.Probe(_ctx, CreateBPMNTransformationResult(_flowchart)));
        }

        [TestMethod]
        public void Probe_inco_any_other_Activity_but_not_Flowchart()
        {
            Assert.AreEqual(false, _sut.Probe(_ctx, CreateBPMNTransformationResult(new Sequence())));
        }

        [TestMethod]
        public void Simplify_inco_Flowchart_empty()
        {
            var actual = _sut.Simplify(_ctx, CreateBPMNTransformationResult(_flowchart));

            Verify_BPMNTransformationResult(_flowchart, actual);
        }

        [TestMethod]
        public void Currently_no_further_tests_because_of______()
        {
            
        }
    }
}